www.gusucode.com > 6KBBS ASP版 V7.1 > 6KBBS ASP版 V7.1\code\bbs\inc\regfun.asp
<% dim re,str,str1,lens,pass_c function ubbg(str) Set re=new RegExp re.IgnoreCase=true re.Global=True re.Pattern="((javascript:)|(height)|(width)|(jscript:)|(object)|(script)|(js:)|(vbscript:)|(vbs:)|(\.value)|(about:)|(file:)|(document.cookie)|(on(mouse|exit|error|click|key|load)))" str=re.Replace(str,"") re.Pattern="(&#)" str=re.Replace(str,"&#") re.Pattern="(\|)" str=re.Replace(str,"|") set re=Nothing ubbg=str end function function strlength(str) set re=new regexp re.Global=true re.IgnoreCase=true re.Pattern="[\u4E00-\u9FA5\uF900-\uFA2D]" set str1=re.Execute(str) for each i in str1 lens=lens+1 next lens=lens + len(str) strLength=lens end function Function passc(str) passc=true If str <> "" Then set re = New RegExp re.Global = True re.IgnoreCase = True re.Pattern="[^A-Za-z#0-9]" pass_c=re.Test(str) end if if pass_c then passc=false end function function pass_name(str) pass_name=true if Instr(str,"=")>0 or Instr(str,"%")>0 or Instr(str,chr(32))>0 or Instr(str,"?")>0 or Instr(str,"&")>0 or Instr(str,";")>0 or Instr(str,",")>0 or Instr(str,"'")>0 or Instr(str,".")>0 or Instr(str,chr(34))>0 or Instr(str,chr(9))>0 or Instr(str,"")>0 or Instr(str,"$")>0 or Instr(str,chr(255))>0 or Instr(str,":") or instr(str,"|")>0 or instr(str,"#")>0 or instr(str,"`")>0 or instr(str,"\")>0 or instr(str,"(")>0 or instr(str,"[")>0 or instr(str,"-")>0 or instr(str,"~") or instr(str," ")>0 or instr(str,chr(-24159))>0 or instr(str,chr(-23299))>0 then pass_name=false end if end function function IsValidEmail(email) if len(email)>40 then IsValidEmail=false exit function end if Set re = new RegExp re.pattern = "([\.a-zA-Z0-9_-]){3,10}@([a-zA-Z0-9_-]){2,10}(\.([a-zA-Z0-9]){2,}){1,4}$" IsValidEmail=re.Test(email) end function %>